Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

138
Views
Why is react-font-picker gives error "Error: Cannot update active font: "Fira Sans" is not in the font list"?

I am using font picker in my project like this.

<FontPicker
                          apiKey={process.env.REACT_APP_GOOGLE_API_KEY}
                          activeFontFamily={activeFontFamilyMobile}
                          onChange={(nextFont) =>
                            setActiveFontFamilyMobile(nextFont.family)
                          }
                        />

The already saved font in stored in the backend, which I am fetching and setting up like this in use Effect:

            setActiveFontFamilyMobile(response.data.font_family);

and by default, the state is like this:

  const [activeFontFamilyMobile, setActiveFontFamilyMobile] = React.useState("Raleway");

So the problem is that when the page loads for the first time, saved font_family comes from the backend and is stored in activeFontFamilyMobile. And in the parameters of fontPicker, it should be displayed by activeFontFamily={activeFontFamilyMobile}. But it gives error like this: Error

But if I make some changes in the code and cause a re-render, it starts working. So its not working when the pages loads first time. What might be the issue?

almost 4 years ago · Santiago Trujillo
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!